import Cookies from 'js-cookie'

const SystemKey = 'Cis-Match-System'

const TokenKey = 'cis-token'

const ManageTokenKey = 'Cis-Manage-Token'

const TokenKeyType = 'Cis-Token-Type'

const ManageTokenKeyType = 'Cis-Manage-Token-Type'

const UserNavbars = 'Cis-User-Navbars'

const UserSidebars = 'Cis-User-Sidebars'

const UserPermissions = 'Cis-User-Permissions'

const UrlType = 'Cis-Url-Type'

const LoginUserInfo = 'Cis-Login-User'

export function getToken() {
  // return Cookies.get(TokenKey, { domain: '.hbskills.org.cn' })
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  // return Cookies.set(TokenKey, token, { domain: '.hbskills.org.cn' })
  return Cookies.set(TokenKey, token)
}

export function getSystem() {
  return Cookies.get(SystemKey)
  // return Cookies.get(SystemKey, { domain: '.hbskills.org.cn' })
}

export function setSystem(system) {
  return Cookies.set(SystemKey, system)
  // return Cookies.set(SystemKey, system, { domain: '.hbskills.org.cn' })
}

export function getManageToken() {
  return Cookies.get(ManageTokenKey)
}

export function setManageToken(token) {
  return Cookies.set(ManageTokenKey, token)
}

export function removeToken() {
  Cookies.remove(TokenKey)
  Cookies.remove(TokenKeyType)
  Cookies.remove(TokenKeyType, { domain: '.hbskills.org.cn' })
  return Cookies.remove(TokenKey, { domain: '.hbskills.org.cn' })
}

export function removeManageToken() {
  return Cookies.remove(ManageTokenKey)
}

export function getTokenType() {
  // return Cookies.get(TokenKeyType, { domain: '.hbskills.org.cn' })
  return Cookies.get(TokenKeyType)
}

export function getManageTokenType() {
  return Cookies.get(ManageTokenKeyType)
}

export function setTokenType(tokenType) {
  // return Cookies.set(TokenKeyType, tokenType, { domain: '.hbskills.org.cn' })
  return Cookies.set(TokenKeyType, tokenType)
}

export function setManageTokenType(tokenType) {
  return Cookies.set(ManageTokenKeyType, tokenType)
}

export function getUrlType() {
  return Cookies.get(UrlType)
}

export function setUrlType(type) {
  return Cookies.set(UrlType, type)
}

export function setNavbars(navbars) {
  return Cookies.set(UserNavbars, navbars)
}

export function setSidebars(sidebars) {
  return Cookies.set(UserSidebars, sidebars)
}

export function setPermissions(permissions) {
  return Cookies.set(UserPermissions, permissions)
}

export function setUserInfo(userInfo) {
  // return Cookies.set(LoginUserInfo, userInfo, { domain: '.hbskills.org.cn' })
  return Cookies.set(LoginUserInfo, userInfo)
}

export function getUserInfo() {
  // return Cookies.get(LoginUserInfo, { domain: '.hbskills.org.cn' })
  return Cookies.get(LoginUserInfo)
}

export function removeUserInfo() {
  Cookies.remove(LoginUserInfo)
  return Cookies.remove(LoginUserInfo, { domain: '.hbskills.org.cn' })
  // return Cookies.remove(LoginUserInfo)
}
